package it.polito.connectedcar.vehicle;

import it.polito.connectedcar.tcc.zone.Token;

/**
 * Token implementation used to represent a unique vehicle inside the SUMO
 * simulated environment
 * 
 * @author Nicola Aresta
 * 
 */
public class SUMOVehicleToken implements Token {

    private String vehicleId;

    public SUMOVehicleToken(String vehicleId) {
	this.vehicleId = vehicleId;
    }

    @Override
    public byte[] getBytes() {
	return vehicleId.getBytes();
    }

    @Override
    public String toString() {
	return vehicleId;
    }

    @Override
    public boolean equals(Object obj) {
	if (obj instanceof Token || obj instanceof String)
	    return vehicleId.equals(obj.toString());
	else
	    return false;
    }

}
